home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / Development Tools & Languages / DTSCPlusLibrary / Sources / Template.h < prev    next >
Encoding:
Text File  |  1993-01-14  |  4.1 KB  |  112 lines  |  [TEXT/MPS ]

  1. /* _________________________________________________________________________________________________________ //
  2.   Copyright © 1992 Apple Computer, Inc. All rights reserved.
  3.   Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework.
  4.   Originator: Kent Sandvik
  5.   Date: Wednesday, June 10, 1992 22:37:24
  6.   Revision comments are at the end of this file.
  7.   ---
  8.   TFoo is an xxx class (••• describe the class in one sentence •••)
  9.   Template.h contains the header file information for the TFoo class (••• describe the file here •••).
  10.   _________________________________________________________________________________________________________ */
  11.  
  12. // ••• Define the label so the file will be included only once. Note that 
  13. // ••• we use only one _ instead of two in order to conform to the ANSI specs. 
  14. // ••• Also don't forget the last #endif at the end of the file!
  15.  
  16. #ifndef _FOO_
  17. #define _FOO_
  18.  
  19. // ••• This is the only header file we always need to include, it contains the 
  20. // ••• global headers, structures and functions for all classes.
  21. #ifndef _DTSCPLUSLIBRARY_
  22. #include "DTSCPlusLibrary.h"
  23. #endif
  24.  
  25. // ••• Specify below all the needed Macintosh toolbox interfaces - don't just 
  26. // ••• include one file and assume that this file will include more files. 
  27. // ••• Each header file should be self-contained. 
  28. //    Toolbox Include Files
  29. #ifndef __PROCESSES__
  30. #include <Processes.h>
  31. #endif
  32.  
  33. #ifndef __APPLEEVENTS__
  34. #include <AppleEvents.h>
  35. #endif
  36.  
  37.  
  38. // ••• Specify any global structures and enums/typedefs here
  39. // Global structures, typdefs and enums
  40.  
  41. const ProcessSerialNumber kMyProcess = {
  42.                                         kNoProcess, kNoProcess};
  43.  
  44.  
  45. // ••• Here is the start of the class definition. Each file should only have
  46. // ••• one class definition, unless we are dealing with really small classes.
  47. // ••• Why are all member functions virtual? It's for SLM support, and developers could change this easily.
  48. // _________________________________________________________________________________________________________ //
  49. //    TFoo Class Interface
  50.  
  51. class TFoo
  52. {
  53.     // ••• Provide information about the TFoo class here - this because using a browser we 
  54.     // ••• will have information needed concerning how to use the class.
  55. public:
  56.     // ••• This section will contain any class specific typedefs and enums. The reason 
  57.     // ••• it's the first section has to do with C++, you need to specify enums and 
  58.     // ••• typedefs before using them…
  59.     //     TYPEDEFS AND ENUMS
  60.     enum EConstants
  61.     {
  62.         kFirstThing = 1, kLastThing = 999
  63.     };
  64.  
  65.     // ••• Here we will specify all the constructors and destructors needed 
  66.     //    CONSTRUCTORS & DESTRUCTOR
  67.     TFoo();                                        // default constructors
  68.     virtual~ TFoo();                            // virtual destructor
  69.  
  70.     // ••• This section will contain the main interfaces to the class itself.
  71.     //  MAIN INTERFACE
  72.     virtual Boolean KillApplication(ProcessSerialNumber*);// quit the application
  73.     virtual short GetNumProcesses();            // get the N amount of currently running procs
  74.  
  75.     // ••• This section will contain the get and set member functions.
  76.     //    PUBLIC ACCESSORS AND MUTATORS    
  77.     virtual ProcessSerialNumber GetMyProcessID() const;
  78.  
  79.     // ••• This section will contain possible iterators, note the keywords Next, Last, First and Reset.
  80.     // ITERATORS
  81.     virtual void Next();                        // next PSN
  82.     virtual Boolean Last();                        // last PSN?
  83.     virtual void First();                        // first PSN
  84.     virtual void Reset();                        // reset the list to the last entry
  85.  
  86.     //    ••• This section will contain fields inside the class.
  87.     //    FIELDS
  88. protected:
  89.     ProcessSerialNumber fProcessID;                // any specific PSN number
  90.     ProcessSerialNumber fMyProcessID;            // our PSN number
  91.     ProcessSerialNumber fFirstPSN;                // the first one we got
  92.     Boolean fFirstTime;                            // signals order of iterators
  93.     Boolean fLast;                                // used to signal last process in an iterator list
  94. private:
  95.     Boolean fState;                                // state of the object
  96.     OSErr fError;                                // latest toolbox error
  97. };
  98.  
  99.  
  100. #endif
  101.  
  102. // _________________________________________________________________________________________________________ //
  103.  
  104.  
  105. /*    Change History (most recent last):
  106.   No        Init.    Date        Comment
  107.   1            khs        6/10/92        New file
  108.   2            khs        7/6/92        First decent working class
  109. */
  110.  
  111.  
  112.